package cn.iocoder.yudao.module.handguard.dal.mysql.productaccesspercentage;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.handguard.dal.dataobject.productaccesspercentage.ProductAccessPercentageDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.handguard.controller.admin.productaccesspercentage.vo.*;

/**
 * 准入产品-提成参数 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ProductAccessPercentageMapper extends BaseMapperX<ProductAccessPercentageDO> {

    default PageResult<ProductAccessPercentageDO> selectPage(ProductAccessPercentagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductAccessPercentageDO>()
                .eqIfPresent(ProductAccessPercentageDO::getProductAccessId, reqVO.getProductAccessId())
                .eqIfPresent(ProductAccessPercentageDO::getDeductType, reqVO.getDeductType())
                .eqIfPresent(ProductAccessPercentageDO::getDirectProfit, reqVO.getDirectProfit())
                .eqIfPresent(ProductAccessPercentageDO::getIndirectProfit, reqVO.getIndirectProfit())
                .eqIfPresent(ProductAccessPercentageDO::getGrossProfit, reqVO.getGrossProfit())
                .eqIfPresent(ProductAccessPercentageDO::getRegionalManagerRoyalty, reqVO.getRegionalManagerRoyalty())
                .eqIfPresent(ProductAccessPercentageDO::getBusinessSupervisorRoyalty, reqVO.getBusinessSupervisorRoyalty())
                .eqIfPresent(ProductAccessPercentageDO::getBusinessManagerRoyalty, reqVO.getBusinessManagerRoyalty())
                .eqIfPresent(ProductAccessPercentageDO::getReferrerRoyalty, reqVO.getReferrerRoyalty())
                .eqIfPresent(ProductAccessPercentageDO::getClientRoyalty, reqVO.getClientRoyalty())
                .betweenIfPresent(ProductAccessPercentageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProductAccessPercentageDO::getId));
    }

    default List<ProductAccessPercentageDO> selectList(ProductAccessPercentageExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ProductAccessPercentageDO>()
                .eqIfPresent(ProductAccessPercentageDO::getProductAccessId, reqVO.getProductAccessId())
                .eqIfPresent(ProductAccessPercentageDO::getDeductType, reqVO.getDeductType())
                .eqIfPresent(ProductAccessPercentageDO::getDirectProfit, reqVO.getDirectProfit())
                .eqIfPresent(ProductAccessPercentageDO::getIndirectProfit, reqVO.getIndirectProfit())
                .eqIfPresent(ProductAccessPercentageDO::getGrossProfit, reqVO.getGrossProfit())
                .eqIfPresent(ProductAccessPercentageDO::getRegionalManagerRoyalty, reqVO.getRegionalManagerRoyalty())
                .eqIfPresent(ProductAccessPercentageDO::getBusinessSupervisorRoyalty, reqVO.getBusinessSupervisorRoyalty())
                .eqIfPresent(ProductAccessPercentageDO::getBusinessManagerRoyalty, reqVO.getBusinessManagerRoyalty())
                .eqIfPresent(ProductAccessPercentageDO::getReferrerRoyalty, reqVO.getReferrerRoyalty())
                .eqIfPresent(ProductAccessPercentageDO::getClientRoyalty, reqVO.getClientRoyalty())
                .betweenIfPresent(ProductAccessPercentageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProductAccessPercentageDO::getId));
    }

}
